home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Magazine / C_Tutorial / Part-13 / PatchLib / source / FindPatch.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-01  |  1.8 KB  |  68 lines

  1. /*
  2. **    patch.library
  3. **
  4. **    Copyright © 1993-1997 by Stefan Fuchs
  5. **        Freely distributable.
  6. */
  7.  
  8. #ifndef _PATCH_INCLUDES_H
  9. #include "patch_includes.h"
  10. #endif
  11.  
  12.  
  13. /****** patch.library/FindPatch ***************************************
  14. *
  15. *   NAME
  16. *        FindPatch -- find a patch structure with a given name.
  17. *
  18. *   SYNOPSIS
  19. *        patch = FindPatch( name )
  20. *        D0                 A0
  21. *
  22. *        struct Patch *FindPatch( STRPTR );
  23. *
  24. *   FUNCTION
  25. *        This function will search the patch.library lists for a
  26. *        patch structure with the given name. The first patch matching
  27. *        this name will be returned.
  28. *
  29. *        This function exists only for historic reasons.
  30. *        It will internally be routed to FindPatchTags().
  31. *
  32. *   INPUTS
  33. *        name = Name of the patch structure to find
  34. *
  35. *   RESULT
  36. *        patch = a pointer to the patch structure with the same name else
  37. *                NULL to indicate that the string was not found.
  38. *
  39. *   NOTES
  40. *        If your task is not the owner of the patch, the
  41. *        pointer is only valid as long as the system is in forbid().
  42. *        From V2 on you may also lock the patch.library semaphore
  43. *        before calling this function. In this case a pointer to
  44. *        a patch structure is guaranteed to be valid, until you
  45. *        release the semaphore. The semaphore, however, should be kept
  46. *        locked only for short periods of time in order not to block
  47. *        other tasks.
  48. *
  49. *   BUGS
  50. *
  51. *   SEE ALSO
  52. *        InstallPatch(), RemovePatch(), patch.h
  53. *
  54. ******************************************************************************
  55. *
  56. */
  57.  
  58. struct Patch * LIBFUNC FindPatch( REGA0 STRPTR name GNUC_REGA0)
  59. {
  60. struct TagItem taglist[2];
  61.     taglist[0].ti_Tag = PATT_PatchName;
  62.     taglist[0].ti_Data = (ULONG) name;
  63.  
  64.     taglist[1].ti_Tag = TAG_DONE;
  65.  
  66.     return (FindPatchTagsA(taglist));
  67. }
  68.